/*******************************************************************************
 * Copyright (c) 2009 Dop Sun.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Dop Sun - initial API and implementation
 ******************************************************************************/
package com.softao.ming.gde.internal.core.ant;

import org.eclipse.pde.internal.build.ant.AntScript;
import org.eclipse.pde.internal.build.ant.ITask;

/**
 * 
 */
@SuppressWarnings("restriction")
public class GwtCompileTask implements ITask {
	private String mOutputLocation;
	private String mEntryPointClass;
	private String classpathId;

	/**
	 * 
	 */
	public GwtCompileTask() {
	}
	
	@Override
	public void print(AntScript script) {
		script.printTab();
		script.printTab();
		script.print("<java");
		
		script.printAttribute("classname", "com.google.gwt.dev.Compiler", true);
		//script.printAttribute("classname", "com.google.gwt.dev.GWTCompiler", true);
		script.printAttribute("fork", "true", true);
		script.println(">");
		/*
		script.printTabs();
		script.print("<arg");
		script.printAttribute("value", "-out", true);
		script.println("/>");
		script.printTabs();
		script.print("<arg");
		script.printAttribute("value", mOutputLocation, true);
		script.println("/>");
		script.printTabs();
		script.print("<arg");
		script.printAttribute("value", "%*", true);
		script.println("/>");
		*/
		script.printTabs();
		script.print("<jvmarg");
		script.printAttribute("value", "-Xmx512M", true);
		script.println("/>");
		
		script.printTabs();
		script.print("<arg");
		script.printAttribute("value", mEntryPointClass, true);
		script.println("/>");
		
		script.printTabs();
		script.print("<classpath");
		script.printAttribute("refid", classpathId, true);
		script.println("/>");
		
		script.println("</java>");
	}

	/**
	 * @param outputLocation the outputLocation to set
	 */
	public void setOutputLocation(String outputLocation) {
		mOutputLocation = outputLocation;
	}

	/**
	 * @return the outputLocation
	 */
	public String getOutputLocation() {
		return mOutputLocation;
	}

	/**
	 * @param entryPointClass the entryPointClass to set
	 */
	public void setEntryPointClass(String entryPointClass) {
		mEntryPointClass = entryPointClass;
	}

	/**
	 * @return the entryPointClass
	 */
	public String getEntryPointClass() {
		return mEntryPointClass;
	}

	/**
	 * @param classpathId the classpathId to set
	 */
	public void setClasspathId(String classpathId) {
		this.classpathId = classpathId;
	}

	/**
	 * @return the classpathId
	 */
	public String getClasspathId() {
		return classpathId;
	}
}
